//////////Change the directory before running the code
///////////// Load file
cd "D:\data&code"
use pseudo_dataset/voting, clear
keep if contest == 1

	
//////////// Reduced-form: passive funds only
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		log_port_val					///
		port_share						///			
		horizon 						///
		basis_ret               		///
		if passive == 1 				///
		, 								///
		absorb(proxy_year ff48 fund_id) ///
		vce(cluster fund_family_id)
	
outreg2 using table_5,  		///
		dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 
		)               						/// 
		replace		
	
//////////// Reduced-form: active funds only
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		log_port_val					///	
		port_share						///		
		horizon 						///
		basis_ret               		///
		if passive == 0 				///
		, 								///
		absorb(proxy_year ff48 fund_id) ///
		vce(cluster fund_family_id)
		
outreg2 using table_5,  						///
		dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 
		)               						/// 
		append
		
//////////// Reduced-form: all funds, two passive dummies
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		log_port_val					///
		port_share						///			
		horizon 						///
		basis_ret               		///
		passive_big3 					///
		passive_xbig3 					///		
		, 								///
		absorb(proxy_year ff48) 		///
		vce(cluster fund_family_id)
	
outreg2 using table_5, 					 		///
		dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 
			passive_big3 						///
			passive_xbig3 						///			
		)               						/// 
		append			
		
//////////// Reduced-form: B3 passive funds
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		log_port_val					///
		port_share						///			
		horizon 						///
		basis_ret               		///
		if passive_big3 == 1			///
		, 								///
		absorb(proxy_year ff48 fund_id) ///
		vce(cluster fund_family_id)
	
outreg2 using table_5,  						///
		dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 		
		)               						/// 
		append			

//////////// Reduced-form: non-B3 passive funds
reghdfe vote_num   						///
		logmv              				///
		q_CCM       	        		///
		roa_CCM                 		///
		leverage_CCM            		///
		divyld_CCM              		///
		hhi 							///
		inst_13f 						///
		hf  							///
		no_camp 						///
		share_intensity 				///
		log_port_val					///
		port_share						///			
		horizon 						///
		basis_ret               		///
		if passive_xbig3 == 1			///
		, 								///
		absorb(proxy_year ff48 fund_id) ///
		vce(cluster fund_family_id)
	
outreg2 using table_5,  						///
		dta 									///
		tstat 									///
		adjr2 									///
		bdec(3) 								///
		tdec(2)  								///
		bracket 								///
		nocons 									///
		nonotes 								///
		label 									///
		keep ( 									///
			logmv              					///
			q_CCM       	        			///
			roa_CCM                 			///
			leverage_CCM            			///
			divyld_CCM              			///
			hhi 								///
			inst_13f 							///
			hf  								///
			no_camp 							///
			share_intensity 					///
			log_port_val 						///
			port_share							///	
			horizon 							///
			basis_ret 							/// 		
		)               						/// 
		append		

////////
use table_5_dta, clear
rm table_5.txt
browse
